<extend name="Layout/application"/>

<block name="content">
    <div class="row">
        <div class="col-md-12">

            <div class="row">
                <div class="col-md-8">
                    <div class="page-header">
                        <h1>内容管理</h1>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-md-10">
                    <div class="panel panel-default">
                        <div class="panel-heading">栏目管理</div>
                        <div class="panel-body">
                            <form role="form" method="post" action="{{:U('sort')}}">
                                <!-- Standard button -->
                                <a href="{{:U('create')}}">
                                    <button type="button" class="btn btn-primary">新增顶级栏目</button>
                                </a>

                                <!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
                                <button type="submit" class="btn btn-success">排序</button>


                                <table class="table table-bordered ">
                                    <thead>
                                    <tr>
                                        <th class="text-center"><span class="glyphicon glyphicon-th"></span></th>
                                        <th colspan="3">栏目管理</th>
                                    </tr>
                                    <tr>
                                        <th class="col-md-1 text-center">排序</th>
                                        <th class="col-md-6">名称</th>

                                        <th class="text-center">编辑</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <volist name="categories" id="c">
                                        <tr><input type="hidden" name="sort_id[]" value="{{$c.id}}">
                                            <td><input type="text" name="sort_order[]" class="form-control"
                                                       value="{{$c.sort_order}}"></td>
                                            <td><for start="0" end="$c['level']*2">&nbsp;&nbsp;&nbsp;&nbsp;</for>{{$c.name}}</td>
                                            <td class="text-center">
                                                <a href="{{:U('create',array('id'=>$c['id']))}}"><span class="glyphicon glyphicon-plus" style="cursor: pointer"></span></a>&nbsp;&nbsp;&nbsp;
                                                <a href="{{:U('edit',array('id'=>$c['id']))}}"><span class="glyphicon glyphicon-pencil" style="cursor: pointer"></span>&nbsp;&nbsp;&nbsp;</a>
                                                <a onclick="return confirm('确认删除吗？')" href="{{:U('del',array('id'=>$c['id']))}}"><span class="glyphicon glyphicon-remove" style="cursor: pointer"></span></a>
                                            </td>
                                        </tr>
                                    </volist>
                                    </tbody>
                                </table>
                            </form>

                        </div>
                    </div>
                </div>


                <div class="col-md-2">
                    <div class="list-group">
                        <a href="{{:U('create')}}" class="list-group-item list-group-item-info sort_category">
                            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> 新增 (add)
                        </a>

                        <a href="" class="list-group-item list-group-item-info sort_category">
                            <span class="glyphicon glyphicon-refresh" aria-hidden="true"></span> 排序 (sort)
                        </a>
                    </div>
                </div>
            </div>

        </div>
    </div>
</block>
